﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsAcess
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();



        }

        private void Draw()
        {
            Graphics g = this.CreateGraphics();
            int[] values = { 30, 60, 90, 120, 150 };

            Point center = new Point(200, 200);

            g.DrawEllipse(Pens.Blue, center.X, center.Y, 8, 8);
            g.FillEllipse(Brushes.Red, center.X, center.Y, 8,8);

            Pen[] pens = { Pens.BurlyWood,Pens.Chocolate,Pens.CornflowerBlue,Pens.DarkBlue};
            Brush[] brushes = { Brushes.RoyalBlue, Brushes.SeaShell, Brushes.SkyBlue, Brushes.Tomato };


            int beginValue = 90, curCell = 10;

            for (int i = 0; i <12; i++)
            {
                // 角度计算为弧度
                double cellCurve = beginValue + curCell * i;
                cellCurve = cellCurve * Math.PI / 180;
               
                double xPostion = 50 * Math.Sin(cellCurve);
                double yPoint = 50 * Math.Cos(cellCurve);
                Point newPoint = new Point((int)(center.X + xPostion), (int)(center.Y + yPoint));

                g.DrawEllipse(pens[0], newPoint.X, newPoint.Y, 5, 5);
                g.FillEllipse(brushes[0], newPoint.X, newPoint.Y, 5, 5);
            }
        }

        private void Form2_Paint(object sender, PaintEventArgs e)
        {
            Draw();
        }
    }
}
